import org.junit.Assert;
import org.junit.Test;

import java.util.*;

public class NGuessNumberTest {

    @Test
    public void generateAnswerTest(){
        NGuessNumber nGuessNumber = new NGuessNumber();
        List<Integer> FourNum = nGuessNumber.generateAnswer();
        Assert.assertEquals("数字数量不符合",FourNum.size(),4);
        LinkedHashSet<Integer> hashSet = new LinkedHashSet<>(FourNum);
        Assert.assertEquals("存在重复",hashSet.size() , 4);
        Assert.assertEquals("最大值错误",Collections.max(FourNum) <= 9 ? "T":"F" , "T");

    }

    @Test
    public void getPlayerInputTest(){
        NGuessNumber nGuessNumber = new NGuessNumber();
        nGuessNumber.getPlayerInput();
    }

    @Test
    public void compareGuessAnswerTest(){
        List<Integer> a = new LinkedList<>();
        a.add(1);a.add(2);a.add(3);a.add(4);
        List<Integer> b = new LinkedList<>();
        b.add(4);b.add(3);b.add(2);b.add(1);
        NGuessNumber nGuessNumber = new NGuessNumber();
        nGuessNumber.compareGuessAnswer(a,b);
    }

    @Test
    public void isWinTest(){

        NGuessNumber nGuessNumber = new NGuessNumber();
        System.out.println(nGuessNumber.isWin(4));
    }
}
